#pragma once

#include <QtWidgets/QWidget>
#include "ui_hackRain.h"
#include <QMouseEvent> 
#include <QVector>

#define RainNum 15
#define StrNum 5
#define CharH 20

struct Rain
{
    int x;  // 雨串开始点x
    int y;  // 雨串开始点y
    QString str;  // 代码雨的字串
};

class hackRain : public QWidget
{
    Q_OBJECT

public:
    hackRain(QWidget *parent = Q_NULLPTR);

public:
    void initRain();
    // 给字体着色
    void render();
    // 更新位置
    void update();

private:
    Ui::hackRainClass ui;
    QRect m_Screen;
    Rain m_rains[RainNum];
    QPainter* m_painter;
    int status;
    QString dialog_str;
    QString dialog_str1 = "Weak up, Neo...";
    QString dialog_str2 = "The Matrix has you";
    int dialog1_index;
    int dialog2_index;
    int delay_cnt;

private:
    QString enter_flash(int cnt,QString str1,QString str2);
    void paintEvent(QPaintEvent* event);
    void mouseMoveEvent(QMouseEvent* event);
};
